package com.boottest.better.test.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "/jsp")
public class JspController {

    @RequestMapping(value = "/view", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toJspView(ModelAndView view) {

        view.setViewName("index");
        view.addObject("name", "springboot");
        view.addObject("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

        return view;
    }

}
